<?php
/**
 * @param $width
 * @param $height
 * @param $images
 * @param $unique_id
 */
function ivq_front($width, $height, $images, $unique_id) {
  return "<script type=\"text/javascript\" src=\"plugins/ivq/assets/jquery.js\"></script>
          <link rel=\"stylesheet\" href=\"plugins/ivq/assets/global.css\">
          <script type=\"text/javascript\" src=\"plugins/ivq/assets/jquery.easing.1.3.js\"></script>
          <script type=\"text/javascript\" src=\"plugins/ivq/assets/jquery.galleryview1.js\"></script>
          <script type=\"text/javascript\" src=\"plugins/ivq/assets/jquery.timers-1.1.2.js\"></script>
          <script type=\"text/javascript\">
            $(document).ready(function(){
              var pwidth = " . $width . ";
              var pheight = " . $height . ";
              var uniqueId = " . $unique_id . ";
              var fwidth = (pwidth - 50) / 6;
              var fheight = pheight / 7;
              $('.panel_'+uniqueId+' img').css({'width': pwidth + 'px', 'height': pheight + 'px'});
              $('.filmstrip_'+uniqueId+' img').css({'width': fwidth + 'px','height': fheight + 'px'});
              $('#photo_$unique_id').galleryView({
                panel_width: pwidth,
                panel_height: pheight * 6/7-4,
                frame_width: fwidth,
                frame_height: fheight,
                unique: uniqueId,
                pre_nex_btn: true
              });
            });
          </script>
            
          <div id=\"photo_$unique_id\">
            <script type=\"text/javascript\">
              var p = document.getElementById('photo_$unique_id');
              var images = " . $images ."
              for(var i = 0; i < images.length; i++) {
                var div = document.createElement('div');
                div.className = 'panel_$unique_id';
                var img = document.createElement('img');
                img.src = images[i];
                div.appendChild(img);
                p.appendChild(div);
              }
              
              var ul = document.createElement('ul');
              ul.className = 'filmstrip_$unique_id';
              for(var i = 0; i < images.length; i++) {
                var li = document.createElement('li');
                var img = document.createElement('img');
                img.src = images[i];
                li.appendChild(img);
                ul.appendChild(li);
                p.appendChild(ul);
              }
            </script>
          </div>";
}
?>